# 注意过单测
class ArrayPlus:
    _array: list = []

    def __init__(self, initializer=None):
        if initializer is not None:
            self._array = initializer

    def value(self):
        return self._array

    def getValue(self, index: int):
        return self._array[index]

    def push(self, item):
        self._array.append(item)

    def pop(self):
        self._array.pop()

    def drop_right(self, num):
        i = num
        while i > 0:
            i -= 1
            self._array.pop()

    def empty(self):
        self._array = []

    def remove(self, item):
        self._array.remove(item)

    def for_each(self, callback):
        index = 0
        for u in self._array:
            callback(u, index)
            index += 1

    def size(self):
        return len(self._array)

    def find(self, key, value):
        for u in self._array:
            if getattr(u, key) == value:
                return u
